package com.xnyzc.lhy.common.penum.cms;

import io.swagger.models.auth.In;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhaolijie
 * @date:2019-08-25
 */
public enum EVehicleType {
    vehStatusFree(0, "空闲"),
    vehStatusRepair(1, "维修中"),
    vehStatusUse(2, "使用中"),

    vehFuelTypeElectric(0, "纯电动"),
    vehFuelTypeTanker(1, "汽油"),
    vehFuelTypeDiesel(2, "柴油"),
    vehFuelTypeHybird(3, "油电混动"),
    vehFuelTypePlugIn(4, "插电式混动"),

    vehTypeEconomic(0, "经济型"),
    vehTypeComfortable(1, "舒适型"),
    vehTypeBusiness(2, "商务型"),
    vehTypeLuxury(3, "豪华型"),
    ;

    /**
     * 查询车辆状态
     *
     * @param type
     * @return
     */
    public static EVehicleType findVehStatus(Integer type) {
        EVehicleType eVehicleType;
        switch (type) {
            case 0:
                eVehicleType = EVehicleType.vehStatusFree;
                break;
            case 1:
                eVehicleType = EVehicleType.vehStatusRepair;
                break;
            case 2:
                eVehicleType = EVehicleType.vehStatusUse;
                break;
            default:
                throw new IllegalArgumentException("未设置");
        }
        return eVehicleType;
    }


    /**
     * 查询燃油类型
     *
     * @param type
     * @return
     */
    public static EVehicleType findVehFuelType(Integer type) {
        EVehicleType eVehicleType;
        switch (type) {
            case 0:
                eVehicleType = EVehicleType.vehFuelTypeElectric;
                break;
            case 1:
                eVehicleType = EVehicleType.vehFuelTypeTanker;
                break;
            case 2:
                eVehicleType = EVehicleType.vehFuelTypeDiesel;
                break;
            case 3:
                eVehicleType = EVehicleType.vehFuelTypeHybird;
                break;
            case 4:
                eVehicleType = EVehicleType.vehFuelTypePlugIn;
                break;
            default:
                throw new IllegalArgumentException("未设置");
        }
        return eVehicleType;
    }

    /**
     * 查询车辆类型
     *
     * @param type
     * @return
     */
    public static EVehicleType findVehType(Integer type) {
        EVehicleType eVehicleType;
        switch (type) {
            case 0:
                eVehicleType = EVehicleType.vehTypeEconomic;
                break;
            case 1:
                eVehicleType = EVehicleType.vehTypeComfortable;
                break;
            case 2:
                eVehicleType = EVehicleType.vehTypeBusiness;
                break;
            case 3:
                eVehicleType = EVehicleType.vehTypeLuxury;
                break;
            default:
                throw new IllegalArgumentException("未设置");
        }
        return eVehicleType;
    }

    public static List<Integer> getAllVehicleType() {
        List<Integer> types = new ArrayList<>();
        types.add(EVehicleType.vehTypeEconomic.getValue());
        types.add(EVehicleType.vehTypeComfortable.getValue());
        types.add(EVehicleType.vehTypeBusiness.getValue());
        types.add(EVehicleType.vehTypeLuxury.getValue());
        return types;
    }

    private Integer value;
    private String desc;


    EVehicleType(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
}
